#include <stdio.h>

int main() {


    for (int i = 10000; i <= 99999; i++)
    {
        int m = 10;
        int n = 0;
        for (int h = 1; h < 5; h++)
        {
            int q = i % m;
            int w = i / m;
            m = m * 10;
            n = n + q * w;
        }
        if (n == i)
            printf("%d ", i);
    }
    return 0;
}